<%@ page contentType="text/html; charset=UTF-8" language="java" import="java.util.*,com.pub.database.*" %>
<%
//透過AJAX來check部門
  com.pub.database.QueryBean qbnDAO=null;
  StringBuffer lstbSQL=new StringBuffer();
  ArrayList<ArrayList<Object>> aryRowData=null;
  ArrayList<Object> aryData=null;

  try{
    qbnDAO=new com.pub.database.QueryBean(request.getParameter("DB_ALIAS"),Boolean.parseBoolean(request.getParameter("DEBUG")),"big5","big5");

    lstbSQL.append("select dept_no,dept_name from bas_dept where dept_status='Y' and dept_no=UPPER('");
    lstbSQL.append(request.getParameter("dept_no"));
    lstbSQL.append("')");

    aryRowData=qbnDAO.querySQL(lstbSQL.toString());

    if(aryRowData!=null){
      aryData=(ArrayList<Object>)aryRowData.get(0);
      out.println(aryData.toString().substring(1,aryData.toString().length()-1));
    }
    else{
      out.println("null");
    }
  }
  catch(Exception e){
    e.printStackTrace();
  }
  finally{
    if(qbnDAO!=null){
      try{qbnDAO.close();}catch(Exception se){se.printStackTrace();}
    }
    if(aryData!=null){
      aryData.clear();
      aryData=null;
    }
    lstbSQL=null;
  }
%>
